package com.ganzalang.gmall.threadlocal.config;

import com.ganzalang.gmall.threadlocal.interceptor.ParamInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @description:
 * @author: Ganzalang
 * @Date 2021/3/26 16:09
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Bean
    public ParamInterceptor paramInterceptor() {
        return new ParamInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(paramInterceptor())
                .addPathPatterns("/**");
    }
}
